/*!
\copyright  Copyright (c) 2023 - 2025 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\defgroup   downloadable_file Downloadable File
\ingroup    downloadable
\brief      Load files in DSP

This API will load files in DSP and remember them and their DSP handle for future use.

*/

#ifndef DOWNLOADABLE_FILE_H_
#define DOWNLOADABLE_FILE_H_

/*!@{*/

#include <operator.h>

/*! \brief Loads the file on DSP if not already loaded. If loaded adds another user for it.
           Caller must call Downloadable_RemoveFileUser when they no longer require the file to be loaded.
    \param filename The files filename
    \param type The file type to be passed to DSP when loading the file
    \param storage The storage medium to be passed to DSP when loading the file
    \return File handle that is used by DSP (can be send to Operators etc)
*/
DataFileID Downloadable_AddFileUser(const char *filename, OperatorDataFileType type, OperatorDataStorageType storage);

/*! \brief Caller indicates they no longer need the file loaded on DSP. If no other users require it the file will be unloaded from DSP.
    \param filename The files filename (must be the same filename as used in Downloadable_AddFileUser).
*/
void Downloadable_RemoveFileUser(const char *filename);

/*! \brief Similar to Downloadable_AddFileUser, it will load the file on DSP as needed.
           The file is automatically unloaded once the operator is destroyed via Downloadable_DestroyOperator.
    \note Do not use a corresponding Downloadable_RemoveFileUser.
    \param operator The operator handle
    \param filename The files filename
    \param type The file type to be passed to DSP when loading the file
    \param storage The storage medium to be passed to DSP when loading the file
    \return File handle that is used by DSP (can be send to Operators etc)
*/
DataFileID Downloadable_AddOperatorFileUser(Operator operator, const char *filename, OperatorDataFileType type, OperatorDataStorageType storage);

/*!@}*/

#endif /* DOWNLOADABLE_FILE_H_ */
